/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.railway.app;

import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;
import javax.swing.ImageIcon;

/**
 *
 * @author Kenny
 */
public class TrainNFarePanel extends javax.swing.JPanel {

    Image imgArrow = new ImageIcon(this.getClass().getResource("/com/railway/image/arrow.png")).getImage();
    private CardLayout cl;
    /**
     * Creates new form RoutePanel
     */
    public TrainNFarePanel() {
        initComponents();
        cl = (CardLayout) jpTrainNFareCard.getLayout();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jpTrainNFare = new javax.swing.JPanel();
        jpTrainNFareContent = new javax.swing.JPanel();
        jbtTrain = new javax.swing.JButton();
        jbtFare = new javax.swing.JButton();
        jbtTimetable = new javax.swing.JButton();
        jpTrainNFareCard = new javax.swing.JPanel();
        jpNullCard = new javax.swing.JPanel();
        jbtRedeem = new javax.swing.JButton();
        jpTrainNFareArrow = new javax.swing.JPanel(){
            protected void paintComponent(Graphics g){
                super.paintComponent(g);
                g.drawImage(imgArrow, 0, 0, getWidth(), getHeight(), this);
            }
        };

        setPreferredSize(new java.awt.Dimension(870, 460));
        setLayout(null);

        jpTrainNFare.setBackground(new java.awt.Color(220, 220, 220));
        jpTrainNFare.setLayout(null);

        jpTrainNFareContent.setBackground(new java.awt.Color(255, 255, 255));
        jpTrainNFareContent.setLayout(null);

        jbtTrain.setBackground(new java.awt.Color(52, 73, 94));
        jbtTrain.setFont(new java.awt.Font("Segoe UI Emoji", 0, 14)); // NOI18N
        jbtTrain.setForeground(new java.awt.Color(255, 255, 255));
        jbtTrain.setText("Train Maintenance");
        jbtTrain.setFocusPainted(false);
        jbtTrain.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtTrainActionPerformed(evt);
            }
        });
        jpTrainNFareContent.add(jbtTrain);
        jbtTrain.setBounds(5, 5, 180, 50);

        jbtFare.setBackground(new java.awt.Color(52, 73, 94));
        jbtFare.setFont(new java.awt.Font("Segoe UI Emoji", 0, 14)); // NOI18N
        jbtFare.setForeground(new java.awt.Color(255, 255, 255));
        jbtFare.setText("Fare Maintenance");
        jbtFare.setFocusPainted(false);
        jbtFare.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtFareActionPerformed(evt);
            }
        });
        jpTrainNFareContent.add(jbtFare);
        jbtFare.setBounds(230, 5, 180, 50);

        jbtTimetable.setBackground(new java.awt.Color(52, 73, 94));
        jbtTimetable.setFont(new java.awt.Font("Segoe UI Emoji", 0, 14)); // NOI18N
        jbtTimetable.setForeground(new java.awt.Color(255, 255, 255));
        jbtTimetable.setText("Timetable Maintenance");
        jbtTimetable.setFocusPainted(false);
        jbtTimetable.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtTimetableActionPerformed(evt);
            }
        });
        jpTrainNFareContent.add(jbtTimetable);
        jbtTimetable.setBounds(455, 5, 180, 50);

        jpTrainNFareCard.setBackground(new java.awt.Color(255, 255, 255));
        jpTrainNFareCard.setLayout(new java.awt.CardLayout());

        jpNullCard.setBackground(new java.awt.Color(255, 255, 255));
        jpNullCard.setLayout(null);
        jpTrainNFareCard.add(jpNullCard, "nullcard");

        jpTrainNFareContent.add(jpTrainNFareCard);
        jpTrainNFareCard.setBounds(0, 55, 860, 375);

        jbtRedeem.setBackground(new java.awt.Color(52, 73, 94));
        jbtRedeem.setFont(new java.awt.Font("Segoe UI Emoji", 0, 14)); // NOI18N
        jbtRedeem.setForeground(new java.awt.Color(255, 255, 255));
        jbtRedeem.setText("Point Redemption");
        jbtRedeem.setFocusPainted(false);
        jbtRedeem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jbtRedeemActionPerformed(evt);
            }
        });
        jpTrainNFareContent.add(jbtRedeem);
        jbtRedeem.setBounds(675, 5, 180, 50);

        jpTrainNFare.add(jpTrainNFareContent);
        jpTrainNFareContent.setBounds(5, 5, 860, 430);

        add(jpTrainNFare);
        jpTrainNFare.setBounds(0, 20, 870, 440);

        javax.swing.GroupLayout jpTrainNFareArrowLayout = new javax.swing.GroupLayout(jpTrainNFareArrow);
        jpTrainNFareArrow.setLayout(jpTrainNFareArrowLayout);
        jpTrainNFareArrowLayout.setHorizontalGroup(
            jpTrainNFareArrowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 150, Short.MAX_VALUE)
        );
        jpTrainNFareArrowLayout.setVerticalGroup(
            jpTrainNFareArrowLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 20, Short.MAX_VALUE)
        );

        add(jpTrainNFareArrow);
        jpTrainNFareArrow.setBounds(720, 0, 150, 20);
    }// </editor-fold>//GEN-END:initComponents

    private void jbtTrainActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtTrainActionPerformed
        jbtTrain.setBackground(new Color(44, 62, 80));
        jbtFare.setBackground(new Color(52, 73, 94));
        jbtTimetable.setBackground(new Color(52, 73, 94));
        jbtRedeem.setBackground(new Color(52, 73, 94));
        jpTrainNFareCard.add(new TrainPanel(), "traincard");
        cl.show(jpTrainNFareCard, "traincard");
    }//GEN-LAST:event_jbtTrainActionPerformed

    private void jbtFareActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtFareActionPerformed
        jbtTrain.setBackground(new Color(52, 73, 94));
        jbtFare.setBackground(new Color(44, 62, 80));
        jbtTimetable.setBackground(new Color(52, 73, 94));
        jbtRedeem.setBackground(new Color(52, 73, 94));
        jpTrainNFareCard.add(new FarePanel(), "farecard");
        cl.show(jpTrainNFareCard, "farecard");
    }//GEN-LAST:event_jbtFareActionPerformed

    private void jbtTimetableActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtTimetableActionPerformed
        jbtTrain.setBackground(new Color(52, 73, 94));
        jbtFare.setBackground(new Color(52, 73, 94));
        jbtTimetable.setBackground(new Color(44, 62, 80));
        jbtRedeem.setBackground(new Color(52, 73, 94));
        jpTrainNFareCard.add(new TimetablePanel(), "timetablecard");
        cl.show(jpTrainNFareCard, "timetablecard");
    }//GEN-LAST:event_jbtTimetableActionPerformed

    private void jbtRedeemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jbtRedeemActionPerformed
        jbtTrain.setBackground(new Color(52, 73, 94));
        jbtFare.setBackground(new Color(52, 73, 94));
        jbtTimetable.setBackground(new Color(52, 73, 94));
        jbtRedeem.setBackground(new Color(44, 62, 80));
        jpTrainNFareCard.add(new PointRedemptionPanel(), "pointcard");
        cl.show(jpTrainNFareCard, "pointcard");
    }//GEN-LAST:event_jbtRedeemActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jbtFare;
    private javax.swing.JButton jbtRedeem;
    private javax.swing.JButton jbtTimetable;
    private javax.swing.JButton jbtTrain;
    private javax.swing.JPanel jpNullCard;
    private javax.swing.JPanel jpTrainNFare;
    private javax.swing.JPanel jpTrainNFareArrow;
    private javax.swing.JPanel jpTrainNFareCard;
    private javax.swing.JPanel jpTrainNFareContent;
    // End of variables declaration//GEN-END:variables
}
